<?php
require("view_header.php");
//1. 允许管理员进入该页面
$isAllowAccess = isset($_SESSION['administrator']);
// 2. 允许题目编辑人员进入该页面
$isAllowAccess |= isset($_SESSION['problem_editor']);

if (!$isAllowAccess ){
    echo "<a href='../loginpage.php'>Please Login First!</a>";
    exit(1);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf8">
    <title> 题目导入成功 </title>
</head>
<body>
<div class="container col-sm-8 panel panel-default" style="margin-left: 20px; margin-top: 20px;" id="problem_import_success">
    <div class="col-sm-12">
        <center><h3>题目导入成功</h3></center>
    </div>
    <div>
        <h4>请点击如下链接查看已经成功导入的题目</h4>
        <span v-for="pid in pids">
            <a :href="problemUrl(pid)">点此查看题目{{pid}}</a><br/>
        </span>
    </div>
</div>
<script>
    var app = new Vue({
        el: "#problem_import_success",
        data:{
            pids: [],
        },

        created:function () {
            let str_pids= getUrlKey('pids')
            this.pids = JSON.parse(str_pids)
            console.log(this.pids)
        },

        methods:{
            problemUrl(pid) {
                return "../../problem.php?id=" + pid
            }
        }
    });
</script>
</body>
</html>
